//中文
var data_zh = ['你知道吗', '六月', '一日', '星期一', '是', '儿童节'];
//英语
var data_en = ['do you know', 'June', 'One day', 'Monday', 'Yes', 'Children\'s day'];

var a = document.querySelector("#fily");
var b = document.querySelector("#wei");

var h = true;
var m = 1;

//js代码
function zhToEn(){
    for (var i = 0; i < data_zh.length; i++){
        switch(a.value){
            case data_zh[i]:
                b.value = data_en[i];
                h = false;
                m = 0;
                hs();
                break;
            case data_en[i]:
                b.value = data_zh[i];
                h = false;
                m = 1;
                hs();
                break;
        }
    }
    if (h){
        alert("无法翻译");
    }
    h = true;
}


function hs(){
    
    if(m == 0){
        document.getElementById("yw").style.background = '#ffffff';
        document.getElementById("yh").style.background = '#ffffff';
        document.getElementById("zw").style.background = '#5aaaff';
        document.getElementById("zh").style.background = '#5aaaff';
        document.getElementById("yh").style.color = '#000000';
        document.getElementById("yw").style.color = '#000000';
        document.getElementById("zw").style.color = '#ffffff';
        document.getElementById("zh").style.color = '#ffffff';
        m = 1;
    }else {
        document.getElementById("yw").style.background = '#5aaaff';
        document.getElementById("yh").style.background = '#5aaaff';
        document.getElementById("zw").style.background = '#ffffff';
        document.getElementById("zh").style.background = '#ffffff';
        document.getElementById("yh").style.color = '#ffffff';
        document.getElementById("yw").style.color = '#ffffff';
        document.getElementById("zw").style.color = '#000000';
        document.getElementById("zh").style.color = '#000000';
        m = 0;
    }
}



